package jaux.tank.bean.entity.system;

import java.util.Date;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.Table;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.FieldNameConstants;

/**
 * Created  on 2018/4/2 0002.
 *
 */
@Entity
@Table(name = "t_sys_notice")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = true)
@FieldNameConstants
public class Notice extends EntityWithObjectId{
	
	public enum NoticeType{
		SYSTEM,
		MESSAGE,
		TASK
	}
	
	public enum ReceiverFilterType{
		USER,
		DEPT,
		ROLE,
		ALL
	}
	
	@Basic
	@Column(name = "title")
    private String title;
	@Basic
	@Column(name = "type")
	@Enumerated(EnumType.STRING)
    private NoticeType type;

	private String icon;
	@Lob
	@Column(length = 65535)
    private String content;
	@Basic
	@Column(name = "createtime")
    private Date createtime;
	@Basic
	@Column(name = "creater", length = 40)
    private String creater;
	
	@Enumerated(EnumType.STRING)
	private ReceiverFilterType receiverFilterType;
	

	@Basic
	@ElementCollection
	@JoinTable(name = "t_sys_notice_receivers")
	private List<String> receivers;
	
	
}
